home *** CD-ROM | disk | FTP | other *** search
/ NEC SuperScript 860 Solutions / NEC SuperScript 860 Solutions.iso / internet / scripts.lib / DISCONCT.SCR < prev    next >
Text File  |  1994-12-29  |  3KB  |  159 lines

  1. !
  2. !  Copyright (c) 1994
  3. !  by CompuServe Incorporated, Columbus, Ohio
  4. !
  5. !  The information in this software is subject to change without
  6. !  notice and should not be construed as a commitment by CompuServe.
  7. !
  8. !  DISCONCT:
  9. !    Handles all network/modem disconnections
  10. !    %LOCAL  = 1 if hanging up while network script running
  11. !        = 2 if hanging up before connection
  12. !
  13. !+V
  14. ! "3.5.2"
  15. !-V
  16.  
  17. WaitTime = 10;
  18. attempts = 0;
  19.  
  20. CompuServe = 1;
  21. SprintNet = 2;
  22. CSIRnet = 16;
  23. Datex_J = 19;
  24. Internet = 25;
  25. Direct = 40;
  26. Result = %Success;
  27. ifndef %BreakChar = "#";
  28.  
  29. DirectConnect = (%Network = Direct) or (%DialType = 2);
  30.  
  31. ifndef %LOCAL = 0;
  32. if %LOCAL = 1 goto Do_Local_Hangup;
  33. if %LOCAL = 2 goto Send_Hangup;
  34.  
  35. if %Network = Internet goto Exit_Script;
  36. if %Network = CompuServe goto Start_Wait;
  37. if %Network = Direct goto Start_Wait;
  38. if %Network = Datex_J goto Hangup_Datex_J;
  39. if %Network = SprintNet goto Hangup_SprintNet;
  40. if %Network = CSIRnet goto Hangup_CSIRnet;
  41. goto Do_Local_Hangup;
  42.  
  43. Start_Wait:
  44.     wait
  45.         "XPAD:"        goto Hangup_Complete,
  46.         "ITI:"        goto Hangup_Complete,
  47.         "Host Name:"    goto Send_Bye,
  48.         "User ID:"    goto Send_Host,
  49.         "UIC:"        goto Send_UIC,
  50.         %mdm_Failure    goto Hangup_Complete
  51.     until 80;
  52.     goto Do_Local_Hangup;
  53.  
  54. Send_Bye:
  55.     send "BYE^M";
  56.     if DirectConnect goto Hangup_Complete;
  57.     goto Wait_NO_CARRIER;
  58.  
  59. Send_Host:
  60.     send "/HOST^M";
  61.     goto Start_Wait;
  62.  
  63. Send_UIC:
  64.     send "^C";
  65.     wait until 30;
  66.     goto Start_Wait;
  67.  
  68. Hangup_SprintNet:
  69.     show "Disconnecting from SprintNet";
  70.     wait
  71.         "disconnected"  goto Send_Sprint_Hangup
  72.     until 60;
  73.     goto Do_Local_Hangup;
  74.  
  75. Send_Sprint_Hangup:
  76.     wait until 3;
  77.     send "HANGUP^M";
  78.     goto Wait_NO_CARRIER;
  79.  
  80. Hangup_CSIRnet:
  81.     show "Disconnecting from CSIR-Net";
  82.     wait until 40;
  83.     send "Z";
  84.     goto Wait_NO_CARRIER;
  85.  
  86. Hangup_Datex_J:
  87.     show "Disconnecting from Datex-J";
  88.     wait 
  89.         "Host Name:"    goto Send_OFF,  
  90.         "CLR"        goto Clear_PAD
  91.     until 100;
  92.     ! fall through...
  93.  
  94. Clear_PAD:
  95.     wait until 60;
  96.     send "*9#";
  97.     goto Wait_NO_CARRIER;
  98.  
  99. Send_OFF:
  100.     send "OFF" & %CR;
  101.     goto Hangup_Datex_J;
  102.  
  103. Wait_NO_CARRIER:
  104.     if DirectConnect goto Hangup_Complete;
  105.     wait
  106.         "BYE^M"        goto Hangup_Complete,
  107.         %mdm_Failure    goto Hangup_Complete
  108.     until 30;
  109.  
  110.     sendm %mdm_EscapeCode;
  111.  
  112.     wait
  113.         %mdm_Failure    goto Hangup_Complete,
  114.         %mdm_Ack    goto Send_Hangup
  115.     until 20;
  116.     ! fall through...
  117.  
  118. Do_Local_Hangup:
  119.     if DirectConnect goto Hangup_Direct;
  120.  
  121.     wait until 2 * WaitTime;
  122.     sendm %mdm_EscapeCode;
  123.  
  124.     wait
  125.         %mdm_Ack    goto End_Escape_Wait,
  126.         %mdm_Failure    goto Hangup_Complete
  127.     until 20;
  128.     goto Send_Hangup;
  129.  
  130. End_Escape_Wait:
  131.     wait until WaitTime;
  132.     ! fall through...
  133.  
  134. Send_Hangup:
  135.     sendm %mdm_Prefix;
  136.     sendm %mdm_Hangup;
  137.     sendm %mdm_Suffix;
  138.     attempts = attempts + 1;
  139.  
  140.     wait
  141.         %mdm_Ack    goto Hangup_Complete,
  142.         %mdm_Failure    goto Hangup_Complete
  143.     until 15;
  144.  
  145.     if attempts = 2 goto Hangup_Complete;
  146.     goto Do_Local_Hangup;
  147.  
  148. Hangup_Direct:
  149.     sendm %BreakChar;
  150.     sendm %BreakChar;
  151.     sendm %BreakChar;
  152. Hangup_Complete:
  153.     Result = %Cancel;
  154.     if %LOCAL > 0  goto Exit_Script;
  155.     call %Dir & "last.scr" () : Result;
  156. Exit_Script:
  157.     define %LOCAL = 0;
  158.     exit Result;
  159.